package com.fjxd.plane.Util;


import com.fjxd.feign.result.ViewResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ProjectExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public ViewResult doOtherException(Exception ex) {
        //记录日志
        //发送消息给运维
        //发送邮件给开发人员，ex对象发送给开发人员

        //显示异常信息（一定要开启！，否则出现异常时不会显示）
        ex.printStackTrace();
        return new ViewResult(ViewResult.Status.SERVERERROR.getCode(), ViewResult.Status.SERVERERROR.getMessage());
    }
}
